<!--
 * @Author: daidai
 * @Date: 2022-03-01 09:43:37
 * @LastEditors: Please set LastEditors
 * @LastEditTime: 2022-09-09 11:40:22
 * @FilePath: \web-pc\src\pages\big-screen\view\indexs\left-bottom.vue
-->
<template>
  <div
      v-if="pageflag"
      :class="{ 'overflow-y-auto': true }"
      class="left_boottom_wrap beautify-scroll-def"
  >
    <vue3-seamless-scroll :hover="true"
                          :isWatch="true"
                          :limitScrollNum="7"
                          :list="list"
                          :step="0.4"
                          :wheel="true">
      <ul class="left_boottom">
        <li v-for="(item, i) in list" :key="i" class="left_boottom_item">
          <span class="orderNum doudong">{{ i + 1 }}</span>
          <div class="inner_right">
            <div class="dibu"></div>
            <div class="flex">
              <div class="info">
                <span class="labels">小区名称：</span>
                <span class="contents zhuyao doudong wangguan">
                  {{ item.elevator.communityName }}</span
                >
              </div>
              <div class="info">
                <span class="labels">时间：</span>
                <span class="contents " style="font-size: 12px">
                  {{ item.reportTime }}</span
                >
              </div>
            </div>

            <span
                :class="{
                  typeRed: item.remark.split(':')[1].includes('下线'),
                  typeGreen: item.remark.split(':')[1].includes('上线'),
                }"
                class="types doudong"
            >{{ item.remark.split(":")[1] }}</span
            >

            <div class="info addresswrap">
              <span class="labels">电梯名称：</span>
              <span class="contents ciyao" style="font-size: 12px">
                {{ item.elevatorName }}</span
              >
            </div>
          </div>
        </li>
      </ul>
    </vue3-seamless-scroll>
  </div>

  <Reacquire v-else style="line-height: 200px" @onclick="getData"/>
</template>

<script>
import {deviceRemind} from "@/api";

export default {
  data() {
    return {
      timer: null,
      list: [],
      pageflag: true
    };
  },
  created() {

  },

  mounted() {
    this.getData();
  },
  methods: {
    addressHandle(item) {
      let name = item.provinceName;
      if (item.cityName) {
        name += "/" + item.cityName;
        if (item.countyName) {
          name += "/" + item.countyName;
        }
      }
      return name;
    },
    getData() {
      this.pageflag = true;
      // this.pageflag =false
      deviceRemind({
        pageNum: 1,
        pageSize: 20
      }).then((res) => {
        this.list = res.data;
      //   this.timer = setTimeout(() => {
      //     clearTimeout(this.timer);
      //   }, 10000);
      });
    }
  },
  unmounted() {
    console.log("left-bottom unmounted");
    window.clearTimeout(this.timer);
  }
};
</script>
<style scoped>
@import "@/assets/css/variable.scss";

.left_boottom_wrap {
  overflow: hidden;
  width: 100%;
  height: 100%;
}

.doudong {
  overflow: hidden;
  -webkit-backface-visibility: hidden;
  -moz-backface-visibility: hidden;
  -ms-backface-visibility: hidden;
  backface-visibility: hidden;
}

.overflow-y-auto {
  overflow-y: auto;
}

.left_boottom {
  width: 100%;
  height: 100%;

  .left_boottom_item {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 8px;
    font-size: 14px;
    margin: 10px 0;

    .orderNum {
      margin: 0 16px 0 -20px;
    }

    .info {
      margin-right: 10px;
      display: flex;
      align-items: center;
      color: #fff;

      .labels {
        flex-shrink: 0;
        font-size: 12px;
        color: rgba(255, 255, 255, 0.6);
      }

      .zhuyao {
        color: $primary-color;
        font-size: 15px;
      }

      .ciyao {
        color: rgba(255, 255, 255, 0.8);
      }

      .warning {
        color: #e6a23c;
        font-size: 15px;
      }
    }

    .inner_right {
      position: relative;
      height: 100%;
      width: 380px;
      flex-shrink: 0;
      line-height: 1;
      display: flex;
      align-items: center;
      justify-content: space-between;
      flex-wrap: wrap;

      .dibu {
        position: absolute;
        height: 2px;
        width: 104%;
        background-image: url("../../assets/img/zuo_xuxian.png");
        bottom: -10px;
        left: -2%;
        background-size: cover;
      }

      .addresswrap {
        width: 100%;
        display: flex;
        margin-top: 8px;
      }
    }

    .wangguan {
      color: #1890ff;
      font-weight: 900;
      font-size: 15px;
      width: 80px;
      flex-shrink: 0;
    }


    .time {
      font-size: 12px;
      color: #fff;
    }

    .address {
      font-size: 12px;
      cursor: pointer;
    }

    .types {
      width: 30px;
      flex-shrink: 0;
    }

    .typeRed {
      color: #fc1a1a;
    }

    .typeGreen {
      color: #29fc29;
    }
  }
}
</style>